package com.yw.common.core.fs.config;

import com.yw.common.core.fs.config.impl.IniConfigReaderImpl;
import com.yw.common.core.fs.config.impl.JsonConfigReaderImpl;
import com.yw.common.core.fs.config.impl.PropConfigReaderImpl;
import com.yw.common.core.fs.config.impl.TxtConfigReaderImpl;
import com.yw.common.core.fs.config.impl.XmlConfigReaderImpl;
import com.yw.common.core.fs.config.proxy.IniConfigReaderProxy;
import com.yw.common.core.fs.config.proxy.JsonConfigReaderProxy;
import com.yw.common.core.fs.config.proxy.PropConfigReaderProxy;
import com.yw.common.core.fs.config.proxy.TxtConfigReaderProxy;
import com.yw.common.core.fs.config.proxy.XmlConfigReaderProxy;

/**
 * 配置工厂
 * @author aoshiguchen
 * @time 2015-08-20	
 */

public final class ConfigReaderFactory {
	
	private static IConfigReader iniConfigReader = null;
	private static IConfigReader jsonConfigReader = null;
	private static IConfigReader propConfigReader = null;
	private static IConfigReader txtConfigReader = null;
	private static IConfigReader xmlConfigReader = null;
	
	public static IConfigReader createIniConfigReader(){
		if(null == iniConfigReader){
			iniConfigReader = new IniConfigReaderProxy(new IniConfigReaderImpl());
		}
		
		return iniConfigReader;
	}
	
	public static IConfigReader createJsonConfigReader(){
		if(null == jsonConfigReader){
			jsonConfigReader = new JsonConfigReaderProxy(new JsonConfigReaderImpl());
		}
		
		return jsonConfigReader;
	}
	
	public static IConfigReader createPropConfigReader(){
		if(null == propConfigReader){
			propConfigReader = new PropConfigReaderProxy(new PropConfigReaderImpl());
		}
		
		return propConfigReader;
	}
	
	public static IConfigReader createTxtConfigReader(){
		if(null == txtConfigReader){
			txtConfigReader = new TxtConfigReaderProxy(new TxtConfigReaderImpl());
		}
		
		return txtConfigReader;
	}
	
	public static IConfigReader createXmlConfigReader(){
		if(null == xmlConfigReader){
			xmlConfigReader = new XmlConfigReaderProxy(new XmlConfigReaderImpl());
		}
		
		return xmlConfigReader;
	}
	
}
